package com.example.userserver.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.baomidou.mybatisplus.plugins.Page;
import com.example.commons.entity.SysBrandDO;
import com.example.userserver.dao.SysBrandDao;
import com.example.userserver.entity.vo.SysBrandVO;
import com.example.userserver.service.SysBrandService;
import org.springframework.stereotype.Service;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;


/**
 * 
 * <pre>
 * 
 * </pre>
 * <small> 2022-09-21 10:45:59 | lance</small>
 */
@Service
public class SysBrandServiceImpl extends ServiceImpl<SysBrandDao, SysBrandDO> implements SysBrandService {

    @Override
    public Page<SysBrandVO> selBrand(int current, int number,SysBrandVO sysBrandVO) {
        Page<SysBrandVO> page = new Page<SysBrandVO>(current, number);
        return page.setRecords(baseMapper.selBrand(page,sysBrandVO));
    }

    @Override
    public SysBrandDO selBrandById(String id) {
        SysBrandDO sysBrandDO = baseMapper.selectById(id);
//        DateFormat format = new SimpleDateFormat("yyyy-MM-dd"); //格式对应
//        Date parse = null;
//        try {
//            parse = format.parse(sysBrandDO.getBrandTime());
//        } catch (ParseException e) {
//            throw new RuntimeException(e);
//        }
//        sysBrandDO.setBrandTime(parse.toString());
        return sysBrandDO;
    }
}
